<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>HTML5异步上传图片DEMO</title>
<script type="text/javascript" src="../../js/jquery-2.2.2.min.js"></script>
<script type="text/javascript" src="../../js/Upload_beta_v190124.js?<?php echo rand()?>"></script>
</HEAD>
<body>
<div>
  <span>选择文件：</span>
</div>

<input id="icon" type="file" name="icon"  multiple="multiple" value=""/> <input id="uploadButton" type="button" value="上传"/><br>

<script language="javascript">

if(typeof(FormData) !== "undefined"){
	var up = new Upload();
}

var files_name = $('#icon').attr('name');
console.log(files_name);

document.getElementById("uploadButton").onclick = function(){
	if(typeof(FormData) === "undefined"){
		alert("您的浏览器不支持FormData");return;
	}

	up.multUpload({
        url : "../upload/asyncUpload",
        data : {
            "id" : 111,
            "name" : 222,
            "file_2" : "file_2aaa",
        },
        files : document.getElementById('icon').files,
        dataType : 'text',
        success : function (result) {
            console.log(result);
        },
    });
}
</script>
</body>
</html>